package aps

import glory.xxd.Utils

/**
 * 批次开始-删除设备上的物料
 */
class UnloadEQPMeterialController {

    def commentService

    def index() {
        def EqpId = params.EqpId ?: ''
        def OPID = params.OPID ?: ''
        def Type = params.Type ?: ''
        def body = CommentParams.newInstance()
        body.setEqpId(EqpId)
        body.setOPID(OPID)
        body.setType(Type)
        String logUUID = Utils.getUUID();
        Header header = Header.newInstance()
        header.setMESSAGENAME("UnloadEQPMeterial");
        header.setTRANSACTIONID(logUUID);
        def json = commentService.getJsonByObjectForTopic2Queue(logUUID, header, body)

        render json

//        def MaterialPartNo = params.MaterialPartNo ?: ""
//        def EqpId = params.EqpId ?: ""
//        def OPID = params.OPID ?: ""
//        def Type = params.Type ?: ""
//        def RemainTime = params.RemainTime ?: ""
//        def Size = params.Size ?: ""
//        def Device = params.Device ?: ""
//        def WaferSource = params.WaferSource ?: ""
//        def Diagram = params.Diagram ?: ""
//        def ThawEndTime = params.ThawEndTime ?: ""
//        def SawLength = params.SawLength ?: ""
//        def SawThickness = params.SawThickness ?: ""
//        def ExternalDiameter = params.ExternalDiameter ?: ""
//        def InternalDiameter = params.InternalDiameter ?: ""
//
//        def MesMaterial = [MaterialPartNo  : MaterialPartNo,
//                           Size            : Size,
//                           RemainTime      : RemainTime,
//                           Type            : Type,
//                           Name            : params.Name ?: '',
//                           SeqNo           : params.SeqNo ?: '',
//                           Device          : Device,
//                           WaferSource     : WaferSource,
//                           Diagram         : Diagram,
//                           ThawEndTime     : ThawEndTime,
//                           SawLength       : SawLength,
//                           SawThickness    : SawThickness,
//                           ExternalDiameter: ExternalDiameter,
//                           InternalDiameter: InternalDiameter]
//        MesMaterial = Utils.getXmlByJSONHtml(MesMaterial)
//
//        def Materials = [MesMaterial: "${MesMaterial}"]
//        Materials = Utils.getXmlByJSONHtml(Materials)
//
//        def body = [EqpId: EqpId, OPID: OPID, Materials: "${Materials}"]
//        body = Utils.getXmlByJSONHtml([Body: Utils.getXmlByJSONHtml(body)])
//        String logUUID = Utils.getUUID();
//
//        def header = [MESSAGENAME: "UnloadEQPMeterial", TRANSACTIONID: logUUID, USERNAME: "EAP"]
//        header = Utils.getXmlByJSONHtml(header)
//        header = [Header: header]
//        header = Utils.getXmlByJSONHtml(header)
//        def requestStr = header + body
//        def xml = [Request: requestStr]
//
//        xml = Utils.getXmlByJSONHtml(xml)
//
//        //测试
////        xmlReturn =  Utils.getJsonByXML(xmlReturn,"Response/.Body")
////        render xmlReturn
////        return
//        //测试
//
//        def json = commentService.getJsonByObjectForTopic2Queue(logUUID, xml)
//
//        render json
    }
}
